package com.csdj.questions.controller;


import com.csdj.questions.common.WebResult;
import com.csdj.questions.common.WebResultMsgCode;
import com.csdj.questions.entity.Article;
import com.csdj.questions.service.ArticleService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 文章 前端控制器
 * </p>
 *
 * @author 刘宇
 * @since 2022-03-08
 */
@RestController
@RequestMapping("/article")
public class ArticleController {
    @Resource
    private ArticleService articleService;

    /**
     * 查询全部，搜索框热点，按倒序排列
     * @name 刘宇
     * @return
     */
    @GetMapping("/getInfoArticle")
    public WebResult getInfoArticle(){
        List<Article> list = articleService.getInfoArticle();
        if(list != null ){
            return new WebResult(WebResultMsgCode.SUCCESS).putData("article",list);
        }
        return null;
    }
}
